import numpy as np
from common import get_min


def get_opt_min():
    """
    min =  2 * x13 + 3 * x14 + 3 * x23 + x24 + 2 * x35 + 6 * x36 + 3 * x37 + 6 * x38 +
           4 * x45 + 4 * x46 + 6 * x47 + 5 * x48

    x13 + x14 <= 600
    x23 + x24 <= 400

    x13 + x23 - x35 - x36 - x37 - x38 >= 0
    x14 + x24 - x45 - x46 - x47 - x48 >= 0

    x35 + x45 = 200
    x36 + x46 = 150
    x37 + x47 = 350
    x38 + x48 = 300

    :return:
    """
    c = np.array([2, 3, 3, 1, 2, 6, 3, 6, 4, 4, 6, 5])

    a_ub = np.array([[1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                     [-1, 0, -1, 0, 1, 1, 1, 1, 0, 0, 0, 0], [0, -1, 0, -1, 0, 0, 0, 0, 1, 1, 1, 1]])
    b_ub = np.array([600, 400, 0, 0])

    a_ed = np.array([[0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0],
                     [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1]])
    b_ed = np.array([200, 150, 350, 300])

    bounds = ([0, None], [0, None], [0, None], [0, None], [0, None], [0, None], [0, None],
              [0, None], [0, None], [0, None], [0, None], [0, None])

    return get_min(c=c, a_ub=a_ub, b_ub=b_ub, a_ed=a_ed, b_ed=b_ed, bounds=bounds)


if __name__ == '__main__':
    r = get_opt_min()
    print(r)
